| Filename | (eval 1109)[/usr/share/perl/5.10/CGI.pm:869] |
| Statements | Executed 60 statements in 301µs |
| Eval Invoked At | /usr/share/perl/5.10/CGI.pm line 869 |
| Sibling evals | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 2 | 2 | 380µs | 4.08ms | CGI::url |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # spent 4.08ms (380µs+3.70) within CGI::url which was called 2 times, avg 2.04ms/call:
# once (239µs+3.19ms) by main::RUNTIME at line 832 of CGI.pm
# once (141µs+508µs) by main::RUNTIME at line 629 of /usr/share/koha/opac/cgi-bin/opac/opac-search.pl | ||||
| 2 | 2 | 16µs | 2 | 20µs | my($self,@p) = self_or_default(@_); # spent 20µs making 2 calls to CGI::self_or_default, avg 10µs/call |
| 3 | 2 | 33µs | 2 | 246µs | my ($relative,$absolute,$full,$path_info,$query,$base,$rewrite) = # spent 246µs making 2 calls to CGI::Util::rearrange, avg 123µs/call |
| 4 | rearrange(['RELATIVE','ABSOLUTE','FULL',['PATH','PATH_INFO'],['QUERY','QUERY_STRING'],'BASE','REWRITE'],@p); | ||||
| 5 | 2 | 2µs | my $url = ''; | ||
| 6 | 2 | 4µs | $full++ if $base || !($relative || $absolute); | ||
| 7 | 2 | 2µs | $rewrite++ unless defined $rewrite; | ||
| 8 | |||||
| 9 | 2 | 20µs | 2 | 342µs | my $path = $self->path_info; # spent 321µs making 1 call to CGI::AUTOLOAD
# spent 22µs making 1 call to CGI::path_info |
| 10 | 2 | 18µs | 2 | 337µs | my $script_name = $self->script_name; # spent 317µs making 1 call to CGI::AUTOLOAD
# spent 20µs making 1 call to CGI::script_name |
| 11 | 2 | 21µs | 4 | 24µs | my $request_uri = unescape($self->request_uri) || ''; # spent 15µs making 2 calls to CGI::Util::unescape, avg 7µs/call
# spent 9µs making 2 calls to CGI::request_uri, avg 5µs/call |
| 12 | 2 | 17µs | 2 | 487µs | my $query_str = $self->query_string; # spent 322µs making 1 call to CGI::AUTOLOAD
# spent 165µs making 1 call to CGI::query_string |
| 13 | |||||
| 14 | 2 | 3µs | my $rewrite_in_use = $request_uri && $request_uri !~ /^\Q$script_name/; | ||
| 15 | 2 | 900ns | undef $path if $rewrite_in_use && $rewrite; # path not valid when rewriting active | ||
| 16 | |||||
| 17 | 2 | 2µs | my $uri = $rewrite && $request_uri ? $request_uri : $script_name; | ||
| 18 | 2 | 14µs | 2 | 3µs | $uri =~ s/\?.*$//s; # remove query string # spent 3µs making 2 calls to CGI::CORE:subst, avg 2µs/call |
| 19 | 2 | 5µs | $uri =~ s/\Q$ENV{PATH_INFO}\E$// if defined $ENV{PATH_INFO}; | ||
| 20 | # $uri =~ s/\Q$path\E$// if defined $path; # remove path | ||||
| 21 | |||||
| 22 | 2 | 3µs | if ($full) { | ||
| 23 | 2 | 19µs | 2 | 312µs | my $protocol = $self->protocol(); # spent 242µs making 1 call to CGI::AUTOLOAD
# spent 70µs making 1 call to CGI::protocol |
| 24 | 2 | 2µs | $url = "$protocol://"; | ||
| 25 | 2 | 22µs | 4 | 354µs | my $vh = http('x_forwarded_host') || http('host') || ''; # spent 252µs making 1 call to CGI::AUTOLOAD
# spent 102µs making 3 calls to CGI::http, avg 34µs/call |
| 26 | 2 | 11µs | 2 | 2µs | $vh =~ s/\:\d+$//; # some clients add the port number (incorrectly). Get rid of it. # spent 2µs making 2 calls to CGI::CORE:subst, avg 1µs/call |
| 27 | 2 | 3µs | if ($vh) { | ||
| 28 | $url .= $vh; | ||||
| 29 | } else { | ||||
| 30 | 2 | 10µs | 2 | 141µs | $url .= server_name(); # spent 137µs making 1 call to CGI::AUTOLOAD
# spent 4µs making 1 call to CGI::server_name |
| 31 | } | ||||
| 32 | 2 | 9µs | 2 | 8µs | my $port = $self->server_port; # spent 8µs making 2 calls to CGI::server_port, avg 4µs/call |
| 33 | 2 | 7µs | $url .= ":" . $port | ||
| 34 | unless (lc($protocol) eq 'http' && $port == 80) | ||||
| 35 | || (lc($protocol) eq 'https' && $port == 443); | ||||
| 36 | 2 | 1µs | return $url if $base; | ||
| 37 | 2 | 3µs | $url .= $uri; | ||
| 38 | } elsif ($relative) { | ||||
| 39 | ($url) = $uri =~ m!([^/]+)$!; | ||||
| 40 | } elsif ($absolute) { | ||||
| 41 | $url = $uri; | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | 2 | 2µs | $url .= $path if $path_info and defined $path; | ||
| 45 | 2 | 4µs | $url .= "?$query_str" if $query and $query_str ne ''; | ||
| 46 | 2 | 800ns | $url ||= ''; | ||
| 47 | 2 | 16µs | 2 | 6µs | $url =~ s/([^a-zA-Z0-9_.%;&?\/\\:+=~-])/sprintf("%%%02X",ord($1))/eg; # spent 6µs making 2 calls to CGI::CORE:subst, avg 3µs/call |
| 48 | 2 | 28µs | return $url; | ||
| 49 | } | ||||
| 50 | |||||
| 51 | |||||
| 52 | ; |